package com.greensam.pixelengine.pojo.vo.picture.request;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONUtil;
import com.greensam.pixelengine.pojo.base.BaseDto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.util.List;

/**
 * @author Macro_Ray
 * @since 2025/7/2 13:52
 */
@Getter
@Setter
@Schema(description = "图片更新请求")
public class PictureUpdateRequest extends BaseDto {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "图片id")
    @NotNull(message = "picture id is null")
    private Long id;

    @Schema(description = "图片名称")
    private String name;

    @Schema(description = "图片描述")
    private String description;

    @Schema(description = "分类")
    private String category;

    @Schema(description = "标签")
    private List<String> tags;

    @Schema(description = "状态")
    private Boolean status = Boolean.TRUE;

    public String getTagsJson() {
        if (CollectionUtil.isEmpty(tags)) {
            return null;
        }
        return JSONUtil.toJsonStr(tags);
    }


}
